#include <bits/stdc++.h>
using namespace std;
#define mm(a) memset(a,0,sizeof(a));

int Map[10][10];
int res = 0;
int X[] = {0, -1, 1, 0, 0};
int Y[] = {0, 0, 0, -1, 1};
void dfs(int x, int y) {
    if (x == 0 || y == 0 || x == 6 || y == 6) {
        res++;
        return ;
    }
    for (int i = 1; i <= 4; i++) {
        x += X[i], y += Y[i];
        if (!Map[x][y]) {
            Map[x][y] = 1;
            Map[6 - x][6 - y] = 1;
            dfs(x, y);
            Map[6 - x][6 - y] = 0;
            Map[x][y] = 0;
        }
        x -= X[i], y -= Y[i];
    }
}


int main() {
    mm(Map);
    Map[3][3] = 1;
    dfs(3, 3);
    cout << res / 4 << endl;
    return 0;
}